package com.ruoyi.common.utils;

import com.ruoyi.common.model.user.UserVO;

public class UserContext{

    private final static ThreadLocal<UserVO> THREAD_LOCAL = new ThreadLocal<>();

    public static void set(UserVO user){
        THREAD_LOCAL.set(user);
    }

    public static UserVO get(){
        return THREAD_LOCAL.get();
    }

    public static Long getUserId(){
        return get().getId();
    }

    public static void remove(){
        THREAD_LOCAL.remove();
    }
}
